<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="${ctx }" >
<script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.3&amp;key=f9d326eec206fa5f8ae57ccb028fc9bb&amp;"></script>
<!-- 字符编码 -->
<meta charset="UTF-8" content="">
<!-- IE兼容模式 -->
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<!-- 采用高速模式渲染（目前仅有360支持） -->
<meta name="renderer" content="webkit">
<!-- Bootstrap 核心 CSS库 -->
<link href="${ctx }/styles/BJUI/new/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font-awesome 图标 CSS库 -->
<link href="${ctx }/styles/BJUI/new/css/font-awesome.min.css"
	rel="stylesheet">
<!-- JQuery UI CSS库 -->
<link href="${ctx }/styles/BJUI/new/css/jquery-ui.min.css"
	rel="stylesheet">
<!-- JQuery -->
<script src="${ctx }/styles/BJUI/new/js/jquery-1.10.2.min.js"
	type="text/javascript"></script>
<script src="${ctx }/styles/BJUI/new/js/jquery.unobtrusive-ajax.min.js"
	type="text/javascript"></script>
<!-- JQuery UI -->
<script src="${ctx }/styles/BJUI/new/js/jquery-ui.min.js"
	type="text/javascript"></script>
<!-- 脉动提示插件 -->
<script src="${ctx }/styles/BJUI/new/js/jquery.pulsate.min.js"
	type="text/javascript"></script>
<!-- Bootstrap 核心 JS库 -->
<script src="${ctx }/styles/BJUI/new/js/bootstrap.min.js"
	type="text/javascript"></script>
<!-- 浏览器判断 -->
<script src="${ctx }/styles/BJUI/new/js/Browser.js"
	type="text/javascript"></script>
<!-- 母版页 样式 -->
<link href="${ctx }/styles/BJUI/new/css/carousel.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/style.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/leon.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/index.css" rel="stylesheet">
<title>下单</title>

</head>

<body>
	<!-- Start: Ajax Tiper -->
	<!-- Start AJAX提示（全局） -->
	<link href="${ctx }/styles/BJUI/new/css/nprogress.css" rel="stylesheet">
	<script src="${ctx }/styles/BJUI/new/js/nprogress.js"
		type="text/javascript"></script>
	<script type="text/javascript">
		var CurrAjaxCount = 0;
		$(document).ready(function() {
			$(document).ajaxStart(function() {
				if (CurrAjaxCount == 0) {
					NProgress.start();
				}
				CurrAjaxCount = CurrAjaxCount + 1;
			}).ajaxStop(function() {
				CurrAjaxCount = CurrAjaxCount - 1;
				if (CurrAjaxCount <= 0) {
					NProgress.done();
				}
			});
		});
	</script>
	<!--
	wx.getLocation({

			type : 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'

			success : function(res) {
				alert(JSON.stringify(res));
				var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90

				var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。

				var speed = res.speed; // 速度，以米/每秒计

				var accuracy = res.accuracy; // 位置精度
				wx.openLocation({

					latitude : latitude, // 纬度，浮点数，范围为90 ~ -90

					longitude : longitude, // 经度，浮点数，范围为180 ~ -180。

					name : '太平洋世纪广场', // 位置名

					address : '南宁市清秀区太平洋世纪广场', // 地址详情说明

					scale : 1, // 地图缩放级别,整形值,范围从1~28。默认为最大

					infoUrl : '' // 在查看位置界面底部显示的超链接,可点击跳转

				});
			}

		});
	-->


	<!-- End AJAX提示（全局） -->
	<!-- End: Ajax Tiper -->

	<!-- Start: Browser Tiper -->
	<link href="${ctx }/styles/BJUI/new/css/Browsertiper.css"
		rel="stylesheet" />
	<div class="navbar-fixed-top alert alert-danger text-center fade in"
		id="explorer_tiper">
		<button type="button" class="close" data-dismiss="alert"
			aria-label="Close">
			<span aria-hidden="true">&times;</span>
		</button>
		您正在使用 <strong>Internet Explorer</strong>
		低版本的IE浏览器。为更好的浏览本系统，建议您将浏览器升级到 <a
			href="http://rj.baidu.com/soft/detail/14917.html?ald" target="_blank">IE10</a>
		或以下浏览器：<a href="http://www.firefox.com.cn/download/" target="_blank">Firefox</a>
		/ <a href="http://rj.baidu.com/soft/detail/14744.html?ald"
			target="_blank">Chrome</a>
	</div>
	<script type="text/javascript">
		$(function() {
			try {
				// 判断浏览器版本是否过低
				if (!$.support.leadingWhitespace) {
					$("#explorer_tiper").show("slide", 500);
				}
			} catch (e) {
			}
		});
	</script>
	<!-- End: Browser Tiper -->
	<div class="clearfix">
		<div class="carousel-inner" id="mainWindow" style="position: relative">
			<form id="form" class="form-inline" action="">
				<div class="row">
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text">出发</label>
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<input id="originAddress" name="originAddress" class="input-max" value="${data. originAddress}"   onblur="origin()"
							placeholder="详细地址，例：金洲路25号太平洋世纪广场">
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text display-left label-and-input">发货人姓名</label>
						<input class="input-max display-right placeholder-right"
						 value="${data. originName}"
							id="originName" name="originName" placeholder="必填">
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text display-left label-and-input">联系电话</label>
						<input class="input-max display-right placeholder-right"
						 value="${data. originPhone}"
							id="originPhone" name="originPhone" placeholder="18978909232">
					</div>

					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text display-left">所需车型</label>

						<div class="display-right">
							<div class="dropdown">
								<button class="btn btn-default dropdown-toggle" type="button"
									id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
									aria-expanded="true"
									style="border: none; height: 40px; color: #a9a9a9; background-color: #ffffff">
									必填 请选择 <span class="caret"></span>
								</button>
								<ul class="dropdown-menu" aria-labelledby="dropdownMenu1"
									style="min-width: 0">
									<c:forEach var="item" items="${list}">
										<li><a href="javascript:vehicleType(${item.id})">${item.name}</a></li>
									</c:forEach>
								</ul>
							</div>
						</div>
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<input  id="remarks"   	 value="${data. remarks}"  name ="remarks"' class="input-max" placeholder="请填写货物备注，可留空">
					</div>
					<div class="col-sm-8 box-size-120" style="margin-top: 3px">
						<div class="text-center">
							<img src="${ctx }/styles/BJUI/new/images/to_place.png"
								id="destinationAddress" name="destinationAddress"
								style="width: 48px;" alt="">
						</div>
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text">目的</label>
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<input id="destinationAddress" name="destinationAddress"  onblur="destination()"
							 value="${data. destinationAddress}" 
							class="input-max" placeholder="详细地址，例：桂林国家高新区信息产业园">
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text display-left label-and-input">收货人姓名</label>
						<input class="input-max display-right placeholder-right"
							 value="${data. destinationName}" 
							id="destinationName" name="destinationName" placeholder="必填">
					</div>
					<div class="col-sm-8 box-40-mb-1">
						<label class="label-text display-left label-and-input">收货人手机号码</label>
						<input class="input-max display-right placeholder-right"
						 value="${data. destinationPhone}" 
							id="destinationPhone" name="destinationPhone" placeholder="必填">
					</div>
					<div class="col-sm-8 box-size-40" style="background-color: #f5f5f5">
						<input type="checkbox" name="blankRadio" id="blankRadio"
							value="option1" aria-label="Radio button without label text"
							style="margin-left: 10px;"> <label class="label-text"
							style="padding-left: 2px">接受<span style="color: #0099CC">《用户服务条款》</span></label>
					</div>
					<div class="col-sm-8 box-size-40"
						style="position: relative; margin-bottom: 0">
						<div class="item-size">
							<div class="display-left link-40"></div>
							<div class="display-left text-center"
								style="width: 20%; height: 40px;">
								<span style="line-height: 40px;">支付方式</span>
							</div>
							<div class="display-right link-40"></div>
						</div>
					</div>
					<div class="col-sm-8"
						style="position: relative; width: 100%; margin-bottom: 0; padding: 10px; background-color: #ffffff">
						<div class="item-size">
				
							</a> <a class="a-pay">
								<div class="display-left" style="width: 5%; height: 1px"></div>
								<div id="WeChatPay" onclick="javascript:payType(2)"
									class="display-left text-center box-border-40-1 pay">
									<span style="line-height: 40px;">微信支付</span>
								</div>
							</a>

						</div>
					</div>
					<div class="col-sm-8"
						style="background-color: #ffffff; width: 100%">
						<div class="item-size" style="height: 60px"></div>
					</div>
					<div class="col-sm-8" id="footer_item"
						style="position: absolute; bottom: 0; left: 0; width: 100%; margin-bottom: 0; padding: 0">
						<div class="item-size"
							style="background-color: #d7d7d7; height: 50px">
							<div class="display-left text-center" style="width: 70%">
								<span style="line-height: 50px;">计算距离 <span
									id="distanceValue" style="color: #FF0000">${data. distance}</span>公里，收费<span
									id="moneyValue" style="color: #FF0000">${data. money}</span>元
								</span>
							</div>
							<a class="a-orange">
								<div id="confirmButton" onclick="javascript:onBridgeReady()"
									class="display-right text-center cursor-pointer"
									style="width: 30%;">
									<span style="line-height: 50px; color: #ffffff">下单</span>
								</div>
							</a>

						</div>
					</div>
				</div>
				<input type="hidden" name="originLongitude" id="originLongitude" 	 value="${data. originLongitude}"  />
				<input type="hidden" name="originLatitude" id="originLatitude"   value="${data. originLongitude}" /> <input
					type="hidden" name="destinationLatitude" id="destinationLatitude"  value="${data. destinationLatitude}"  />
				<input type="hidden" name="destinationLongitude"
					id="destinationLongitude"   value="${data. destinationLongitude}" /> <input type="hidden"
					name="vehicleType" id="vehicleType"    value="${data. vehicleType}" /> <input type="hidden"
					name="distance" id="distance"   value="${data. distance}" /> <input type="hidden"
					name="payType" id="payType"   value="${data. payType}" /> <input type="hidden" name="money"
					id="money"   value="${data. money}"  />
					<input type="hidden" name="launchAccountId"
					id="launchAccountId"  value="${userid}"/>
						<input type="hidden" name="id"
					id="id"  value="${data. id}"/>
			</form>
		</div>
	</div>
	<script src="${ctx }/styles/BJUI/new/js/ddes.js" charset="UTF-8"
		type="text/javascript"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"
		type="text/javascript"></script>
	<script type="text/javascript">
	function addPrices(){
			var money=		$("#money").val();
			if(money!=null&&money!=""&&$("#addPrice").val()!=null&&$("#addPrice").val()!=""){
			var  number=		$("#addPrice").val();
			if(isNaN(number)){
				alert("加价要输入数字"); 
				return;
			}
			money=parseInt(money)+parseInt(number);
			$("#moneyValue").html("￥" + money + "");
			$("#money").val(money);
			}
	}
		function destinationSkip() {
			window.location.href = "${ctx }/weixinView/position?positionType=1";
		}
		function originSkip() {
			window.location.href = "${ctx }/weixinView/position?positionType=2";
		}
		AMap.service([ "AMap.Geocoder", "AMap.Driving" ], function() { //加载地理编码

		});
		//	初始化jsdk接口
		wx.config({
			debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。

			appId : "${appId}", // 必填，公众号的唯一标识

			timestamp : "${timestamp}", // 必填，生成签名的时间戳

			nonceStr : "${nonceStr}", // 必填，生成签名的随机串

			signature : "${signature}",// 必填，签名，见附录1

			jsApiList : [ "openLocation", "getLocation", "chooseWXPay",
					"checkJsApi" ]
		});
		wx.ready(function() {
			
		});
		function writeObj(obj) {
			var description = "";
			for ( var i in obj) {
				var property = obj[i];
				description += i + " = " + property + "\n";
			}
		}
	</script>
	<script type="text/javascript">
	
		function tasts() {
			//wx.checkJsApi({ //判断是否支持jsdk接口
			//	jsApiList : [ 'getNetworkType', 'previewImage' ],
			//	success : function(res) {
			//			alert(JSON.stringify(res));
			//		}
			//		});
			//	geocoder();
			wx
					.chooseWXPay({
						timestamp : 1414723227,
						nonceStr : 'noncestr',
						package : 'addition=action_id%3dgaby1234%26limit_pay%3d&bank_type=WX&body=innertest&fee_type=1&input_charset=GBK&notify_url=http%3A%2F%2F120.204.206.246%2Fcgi-bin%2Fmmsupport-bin%2Fnotifypay&out_trade_no=1414723227818375338&partner=1900000109&spbill_create_ip=127.0.0.1&total_fee=1&sign=432B647FE95C7BF73BCD177CEECBEF8D',
						paySign : 'bd5b1933cda6e9548862944836a9b52e8c9a2b69'
					});
		}
		function vehicleType(valse, name) {
			$("#vehicleType").val(valse);
			$("#vehiclename").html(name);
			var originAddress = "${originAddress}";
			var destinationAddress = "${destinationAddress}";
			if (originAddress != null && originAddress != ""
					&& destinationAddress != null && destinationAddress != "") {
				$("input[id='destinationAddress']").val(destinationAddress)
				$("input[id='originAddress']").val(originAddress)
				geocoder2($("input[id='destinationAddress']").val());
				geocoder1($("input[id='originAddress']").val());
			}
		}
		function payType(valse) {
			$("#payType").val(valse);
		}
		function yan(tel) {
			var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;
			if (reg.test(tel)) {

				return true;
			} else {

				return false;
			}
		}
		//1、支付
		function onBridgeReady() {
		var che=	$("#blankRadio").prop("checked");
			if(!che){
			if ($("#goodsNname").val() == null || $("#goodsNname").val() == "") {
				alert("请输入货物名称");
				return;

			}
			
			alert("请选择用户服务条款");
			return;
			}
			if ($("#originPhone").val() == null
					|| $("#originPhone").val() == "") {
				alert("请输入发货人手机号码");
				return;

			} 
			 if (!yan($("#originPhone").val())) {
				alert("请输入正确格式的发货人手机号码");
				return;
			}
					if ($("#destinationPhone").val() == null
					|| $("#destinationPhone").val() == "") {
				alert("请输入收货人手机号码");
				return;

			} 
			 if (!yan($("#destinationPhone").val())) {
				alert("请输入正确格式的收货人手机号码");
				return;
			}
			
			if ($("#originAddress").val() == null
					|| $("#originAddress").val() == "") {
				alert("请输入发货人地址");
				return;
			}
			if ($("#originName").val() == null ||$("#originName").val() == "") {
				alert("请输入发货人名字");
				return;
			}

	
			if ($("#destinationAddress").val() == null
					|| $("#destinationAddress").val() == "") {
				alert("请输入目的地址");
				return;

			}

			if ($("#destinationName").val() == null
					|| $("#destinationName").val() == "") {
				alert("请输入收货地名字");
				return;

			}
			if ($("#payType").val() == null || $("#payType").val() == "") {
				alert("请选择支付类型");
				return;

			}
		
			if ($("#vehicleType").val() == null
					|| $("#vehicleType").val() == "") {
				alert("请选择车辆类型");
				return;
			}
			if ($("input[id='originLongitude']").val() == null
					|| $("input[id='originLongitude']").val() == "") {
				if ($("input[id='originAddress']").val() == "") {
					alert("请输入收货地址");
					return;
				}
				if ($("input[id='destinationAddress']").val() == "") {
					alert("请输入收货地址");
					return;
				}
				geocoder2($("input[id='destinationAddress']").val());
				geocoder1($("input[id='originAddress']").val());

				return;
			} else if ($("input[id='originLongitude']").val() != null
					&& $("input[id='originLongitude']").val() != ""
					&& $("#money").val() == null
					&& $("#distance").val() == null) {
				geocoder2($("input[id='destinationAddress']").val());
				geocoder1($("input[id='originAddress']").val());
			}

			$.ajax({
				data : $("#form").serialize(),
				type : "POST",
				dataType : 'json',
				url : "${ctx }/weixinView/orderPay",
				error : function(data) {
					alert("出错了！！:");
				},
				success : function(data) {
					if (data['status'] == 0) {
						var appId = data['data']['appId'];
						var paytimestamp = data['data']['timeStamp'];
						var paynonceStr = data['data']['nonceStr'];
						var paypackage = data['data']['pg'];
						var paySign = data['data']['paySign'];
						//	alert("paySign=" + paySign + "/n paypackage"
						//			+ paypackage + "/n paypackage=" + paynonceStr
						//			+ "/n appId" + appId + "/n paytimestamp"
						//		+ paytimestamp);
						WeixinJSBridge.invoke('getBrandWCPayRequest', {
							"appId" : appId.toString(), //公众号名称，由商户传入     
							"nonceStr" : paynonceStr.toString(), //随机串     
							"package" : "prepay_id=" + paypackage.toString(),
							"signType" : "MD5", //微信签名方式： 
							"timeStamp" : paytimestamp.toString(), //时间戳，自1970年以来的秒数     
							"paySign" : paySign.toString()
						//微信签名 9A0A8659F005D6984697E2CA0A9CF3B7
						}, function(res) {
							//	alert(JSON.stringify(res));
							if (res.err_msg == "get_brand_wcpay_request:ok") {

								window.location.href = data['msg'];
							} // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
							else {
								alert("你取消了支付");
							}
						});
					} else {
						alert(data['msg']);
					}
				}
			});
		}

		function destination() {

			if ($("#originAddress").val() == ""
					|| $("#destinationAddress").val() == null) {

				return;
			}
			if ($("input[id='destinationAddress']").val() == ""
					|| $("input[id='destinationAddress']").val() == null) {

				return;
			}

			geocoder2($("input[id='destinationAddress']").val());
			geocoder1($("input[id='originAddress']").val());

		}
		function origin() {
			if ($("input[id='originAddress']").val() == ""
					|| $("input[id='destinationAddress']").val() == null) {

				return;
			}
			if ($("input[id='destinationAddress']").val() == ""
					|| $("input[id='destinationAddress']").val() == null) {

				return;
			}
			if ($("input[id='originAddress']").val() == ""
					|| $("input[id='destinationAddress']").val() == null) {

				return;
			}
			if ($("input[id='destinationAddress']").val() == ""
					|| $("input[id='destinationAddress']").val() == null) {

				return;
			}
			geocoder2($("input[id='destinationAddress']").val());
			geocoder1($("input[id='originAddress']").val());

		}
		//2-1出发地的经度纬度
		function geocoder1(str) {
			var geocoder = new AMap.Geocoder({
				city : "南宁市", //城市，默认：“全国”
				radius : 1000
			//范围，默认：500
			});
			//地理编码,返回地理编码结果
			geocoder.getLocation("广西南宁市" + str, function(status, result) {
				if (status === 'complete' && result.info === 'OK') {
					$("input[id='originLongitude']").val(
							result['geocodes'][0]['location']['lng']);
					$("input[id='originLatitude']").val(
							result['geocodes'][0]['location']['lat']);
					getlocation();
				}
			});
		}
		//2-2目地地的经度纬度
		function geocoder2(str) {
			var geocoder = new AMap.Geocoder({
				city : "南宁市", //城市，默认：“全国”
				radius : 1000
			//范围，默认：500
			});
			//地理编码,返回地理编码结果
			geocoder.getLocation("广西南宁市" + str, function(status, result) {
				if (status === 'complete' && result.info === 'OK') {
					$("input[id='destinationLongitude']").val(
							result['geocodes'][0]['location']['lng']);
					$("input[id='destinationLatitude']").val(
							result['geocodes'][0]['location']['lat']);
					getlocation();
				}
			});
		}
		//2-3得到两地之间的距离
		function getlocation() {
			if ($("input[id='destinationLatitude']").val() != null
					&& $("input[id='originLongitude']").val() != null
					&& $("input[id='originLongitude']").val() != ""
					&& $("input[id='originLatitude']").val() != ""
					&& $("input[id='destinationLatitude']").val() != ""
					&& $("input[id='destinationLongitude']").val() != "") {

				var driving = new AMap.Driving({
					policy : AMap.DrivingPolicy.LEAST_TIME
				});
				//根据起终点坐标规划驾车路线
				var originLongitude = $("input[id='originLongitude']").val();
				var originLatitude = $("input[id='originLatitude']").val();
				var destinationLongitude = $("input[id='destinationLongitude']")
						.val();
				var destinationLatitude = $("input[id='destinationLatitude']")
						.val();
				driving.search(
						new AMap.LngLat(originLongitude, originLatitude),
						new AMap.LngLat(destinationLongitude,
								destinationLatitude), function(status, result) {
							calculationNunber(result.routes[0].distance);
						});
			}
		}
		//2-4计算价格
		function calculationNunber(number) {
			var value = $("#payType").val();
			if (value != null && value != "") {
				//得到多少公里  整数
				var temp = number / 1000;
				var temp4 = number % 1000;
				var temp1 = 0;
				var temp2 = 0;
				var temp3 = 0;
				var money = 0;
				var vehicleValue = $("#vehicleType").val();
				if (vehicleValue != null && vehicleValue != "") {
					switch (vehicleValue) {
					case "1":
						temp1 = 5;
						temp3 = 60;
						break;
					case "2":
						temp1 = 5;
						temp3 = 70;
						break;
					case "3":
						temp1 = 5;
						temp3 = 75;
						break;
					case "6":
						temp1 = 5;
						temp3 = 100;
						break;
					case "7":
						temp1 = 5;
						temp3 = 120;
						break;
					}

					if (temp > 2) {
						temp2 =Math.floor( temp - 2);
						money = temp3 + temp2 * temp1;
					} else {
						money = temp3;
					}
					$("#money").val(money);
					$("#distance").val(temp);
					$("#distanceValue").html(temp+"公里");
					$("#moneyValue").html("￥" + money + "");
				} else {
					alert("请选择车类型,才能自动计算价格");
				}
			} else {
				alert("请选择支付类型");
			}

		}
		function tast() {

		}

		function writeObj(obj) {
			var description = "";
			for ( var i in obj) {
				var property = obj[i];
				description += i + " = " + property + "\n";
			}
		}
	</script>
	<script type="text/javascript" charset="UTF-8">
		var pays = $(".pay");
		var paysText = $(".pay span");

		$(function() {
		
		var originAddress = "${originAddress}";
			var destinationAddress = "${destinationAddress}";
			if (destinationAddress != null && destinationAddress != "") {
				$("#spandestinationAddress").html(destinationAddress);
			}
			if (originAddress != null && originAddress != "") {
				$("#spanoriginAddress").html(originAddress);
			}
			if (originAddress != null && originAddress != ""
					&& destinationAddress != null && destinationAddress != "") {
				$("input[id='destinationAddress']").val(destinationAddress)
				$("input[id='originAddress']").val(originAddress)
				geocoder2($("input[id='destinationAddress']").val());
				geocoder1($("input[id='originAddress']").val());

			}
			$(pays[0]).css({
				border : '1px #fe9800 solid'
			});
			$(pays[0]).children().css({
				color : '#660000'
			});
			pays.click(function() {
				pays.css({
					border : '1px #cbcbcb solid'
				});
				paysText.css({
					color : '#000000'
				});
				$(this).css({
					border : '1px #fe9800 solid'
				});
				$(this).children().css({
					color : '#660000'
				});
			})
		});
	</script>
</body>
</html>
